﻿using System.Data;

namespace DAL
{
    public static class DalEducational
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable GetEducational(string keywords)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@KEYWORDS", keywords);
            return Cls.GetData("sp_Educational_Get");
        }
        public static DataTable GetEducationalEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Educational_Level_ID", id);
            return Cls.GetData("sp_Educational_Get_Edit");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtEducational obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Educational_Alias", obj.Educational_Alias);
            Cls.AddParameter("@Educational_Name", obj.Educational_Name);
            Cls.AddParameter("@Educational_Note", obj.Educational_Note);
            return Cls.ExecuteNonQuery("sp_Educational_Insert");
        }
        public static bool Update(EtEducational obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Educational_Level_ID", obj.Educational_Level_ID);
            Cls.AddParameter("@Educational_Alias", obj.Educational_Alias);
            Cls.AddParameter("@Educational_Name", obj.Educational_Name);
            Cls.AddParameter("@Educational_Note", obj.Educational_Note);
            return Cls.ExecuteNonQuery("sp_Educational_Update");
        }
        public static bool Delete(EtEducational obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Educational_Level_ID", obj.Educational_Level_ID);
            return Cls.ExecuteNonQuery("sp_Educational_Delete");
        }
        #endregion
    }

    public class EtEducational
    {
        public int Educational_Level_ID { get; set; }
        public string Educational_Alias { get; set; }
        public string Educational_Name { get; set; }
        public string Educational_Note { get; set; }
    }
}